package cn.gov.lyhdga.first.entity;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.validator.constraints.NotBlank;

//JPA标识
@Entity
@Table(name = "lyhdga_message")
public class Message extends IdEntity {
	
	private String title;
	private String sendDate;
	private String content; 
	private User user;
	
	// JSR303 BeanValidator的校验规则
	@NotBlank
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}
	
	public String getSendDate(){
		return sendDate;
	}
	
	public void setSendDate(String sendDate){
		this.sendDate = sendDate;
	}
	
	public String getContent(){
		return content;
	}
	
	public void setContent(String content){
		this.content = content;
	}
	
	// JPA 基于USER_ID列的多对一关系定义
	@ManyToOne
	@JoinColumn(name = "user_id")
	public User getUser(){
		return user;
	}
	
	public void setUser(User user){
		this.user = user;
	}
}
